
package com.oops.appquery;
import java.io.DataInputStream;

import org.json.JSONObject;

public class BookSearch {
	String isbn;
	public BookSearch(String isbn1)throws Exception
	{
		framework obj=new framework();
		isbn=isbn1;
		@SuppressWarnings("deprecation")
		String line= (new DataInputStream(obj.gsearch("http://books.google.com/books?jscmd=viewapi&bibkeys="+isbn)).readLine());
		getBooklinks(line);
		isbn=isbn1;
	}
	public void getBooklinks(String line) throws Exception
    {
		int j=0;
		while(line.charAt(j)!='=')
			j++;
		line=line.substring(j+1);
 	    JSONObject json = new JSONObject(line);
		JSONObject gson=json.getJSONObject(isbn);
		String sample=gson.getString("info_url");		
		System.out.println(sample);	
		}
    }

